/*
 * @Author: 谢陈洁
 * @Date: 2025-05-26 10:13:47
 * @LastEditors: 谢陈洁
 * @LastEditTime: 2025-07-23 23:11:11
 * @Description: file content
 */
// import service from '../request'
import { post, get, upload } from '../../request/http'

// export const getUserList
export const login = (data: Record<string, string>): Promise<any> => {
  // return post('/admin/acl/index/login', {  ...data })
  return post('/user/login', { ...data })
}
// export const login = (data: Record<string, string>): Promise<any> => {
//   return service.post('user/login', data)
// }
export const register = (username: string, password: string, email: string): Promise<any> => {
  return post('/register', { username, password, email })
}

export const getUserList = (data: Record<string, any>): Promise<any> => {
  return post('/user/list', { ...data })
}

export const getUserPermissions = (): Promise<any> => {
  return get('/user/permissions')
}

export const getUserInfo = (userId?: string): Promise<any> => {
  return get('/user/getUserInfo', { userId })
}

export const assignUserRole = (data: Record<string, any>): Promise<any> => {
  return post('/user/assignRole', { ...data })
}
export const saveUserInfo = (data: FormData): Promise<any> => {
  return upload('/user/updateById', data)
}
export const deleteUser = (id: string|number): Promise<any> => {
  return post('/user/deleteById', { id })
}
export const changePassword = (data: Record<string, any>): Promise<any> => {
  return post('/user/updatePassword', { ...data })
}

// export const logout = () => {
//   return post('/logout')
// }
